from datetime import datetime
from numba import jit, int32
n = 15


def calc(n, i=0, cols=0, diags=0, trans=0):
    if i == n:
        return 1
    else:
        return sum(
            [
                calc(n, i + 1, cols | (1 << j), diags |
                     (1 << (i - j + n - 1)), trans | (1 << (i + j)))
                for j in range(n)
                if (cols & (1 << j)) == 0 and (diags & (1 << (i - j + n - 1))) == 0 and (trans & (1 << (i + j))) == 0
            ]
        )


start = datetime.now()
t = calc(15)
end = datetime.now()
print(t)
print(end - start)
print((end - start).seconds*1000+(end - start).microseconds/1000, "ms")
